import request from '@/config/axios'
import { ActiveListParams } from './types'

// 活动列表
export const activeListApi = (params: ActiveListParams) => {
  return request.get({ url: '/active/page', params })
}

// 活动详情
export const activeDetailsApi = (id: number) => {
  return request.get({ url: '/active/details', params: { id } })
}

// 活动分销排行
export const pageRankApi = (params) => {
  return request.get({ url: '/active/pageRank', params })
}

// 活动删除
export const deleteApi = (id) => {
  return request.post({ url: `/active/delete/${id}` })
}

// 商户后台活动列表
export const adminActiveListApi = (params: ActiveListParams) => {
  return request.get({ url: '/admin/business/active/page', params })
}

// 商户后台活动列表
// export const adminActiveListApi = (params: ActiveListParams) => {
//   return request.get({ url: '/admin/business/active/page', params })
// }

// 商户后台活动删除
export const adminDeleteApi = (id) => {
  return request.post({ url: `/admin/business/active/delete/${id}` })
}

// 商户后台活动详情
export const adminActiveDetailsApi = (id: number) => {
  return request.get({ url: '/admin/business/active/details', params: { id } })
}

// 商户后台活动分销排行
export const adminPageRankApi = (params) => {
  return request.get({ url: '/admin/business/active/pageRank', params })
}

// 核销记录
export const pageVerifyRecordApi = (params) => {
  return request.get({ url: '/active/pageVerifyRecord', params })
}

// 商家后台核销记录
export const adminPageVerifyRecordApi = (params) => {
  return request.get({ url: '/admin/active/pageVerifyRecord', params })
}

// 导出核销记录
export const exportVerifyRecordApi = (params) => {
  return request.get({ url: '/active/exportVerifyRecord', params, responseType: 'blob' })
}

// 商家后台导出核销记录
export const adminExportVerifyRecordApi = (params) => {
  return request.get({ url: '/admin/active/exportVerifyRecord', params, responseType: 'blob' })
}

// 拼团团组
export const groupBuyPageGroupApi = (params) => {
  return request.get({ url: '/groupBuyOrder/pageGroup', params })
}
